#include <stdio.h>
#include <stdlib.h>

typedef int ElementType;
typedef struct Node *PtrToNode;

struct Node {
    ElementType m;
    ElementType n;
    PtrToNode   Next;
};
typedef PtrToNode List;
List Derivation(int a,int b);
void LastInsert(List L,List p);
void PrintList(List L,int f);
int main()
{
    List L,p;
    L=(PtrToNode)malloc(sizeof(struct Node));
    L->Next=NULL;
    int a,b,flag=0;
    while(scanf("%d %d",&a,&b)!=EOF){
        if(b!=0){
            flag=1;
            p=Derivation(a,b);
            LastInsert(L,p);
        }
    }
    PrintList(L,flag);
    return 0;

}
List Derivation(int a,int b){
    List node=(PtrToNode)malloc(sizeof(struct Node));
    node->m=a*b;
    node->n=b-1;
    return node;
}
void LastInsert(List L,List p){
    List p1=L;
    while(p1->Next!=NULL){
        p1=p1->Next;
    }
    p->Next=NULL;
    p1->Next=p;
}
void PrintList(List L,int f){
    List p;
    p=L;
    if(f==1){
        int flag=0;
        p=p->Next;
        while(p){
            if(flag==0){
                printf("%d %d",p->m,p->n);
                flag=1;
                p=p->Next;
            }else{
                 printf(" %d %d",p->m,p->n);
                 p=p->Next;
            }
        }
    }else{
        printf("0 0");
    }

}
